<?php
class Somi_Form_NewsForm extends Zend_Dojo_Form
{
	public function init()
	{
		
		$this->setName('News');
		$this->setAction($this->getView()->url())->setMethod('post');
		$this->addAttribs(array('onSubmit'=>'return validate(this)'));
		
		require_once APPLICATION_BASE.'/library/Somi/Validate/ErrorMessageDe.php';
		
		$translateValidators= new Somi_Validate_ErrorMessageDe();
		$translator = new Zend_Translate('array', $translateValidators->getTranslate());
    	Zend_Validate_Abstract::setDefaultTranslator($translator);
    	
    	#$this->clearDecorators();
		$formDecorators=array(
            'FormElements',
        array('HtmlTag',array('tag'=>'dl','class'=>'zend_form')),
            'DijitForm', // hier stand bei dir vorher: 'Form',
        );
                
        
        $elementDecorators=array(
        'DijitElement', // vorher: 'ViewHelper',
        'Errors',
        array(array('data'=>'HtmlTag'),array('tag'=>'div','class'=>'element')),
        array('Label',array('class'=>'left','requiredSuffix' => '*')),
        array(array('row'=>'HtmlTag'),array('tag'=>'div','class'=>'row')),
        );
        
        $buttonDecorators=array(
        'DijitElement', // vorher: 'ViewHelper',
        array(array('data'=>'HtmlTag'),array('tag'=>'div','class'=>'button')),
        array(array('row'=>'HtmlTag'),array('tag'=>'div'))
        );  
		
	
		$filterToLower = new Zend_Filter_StringToLower();
        $filterToLower->setEncoding('UTF-8');
        
		
        #Überschrift
        $ueberschrift=$this->createElement('ValidationTextBox','ueberschrift',array(
        'label'			=> 'Überschrift',
        'alnum'			=>true,
        'required'		=> false,
        #'value'			=> '/firmaname/datei.pdf',
        'PromptMessage'		=> '<div style="width:200px">Schlagzeile bitte angeben</div>', 
        'style'			=> 'width:245px;', 
        'filters'		=> array($filterToLower,),
        #'validators'	=> array('NotEmpty',), 
        ));
        
        
        #Info
		$info=$this->createElement('Textarea','info',array(
		'label'		=> 'Newstext',
		#'style'		=>'height:100px;width:300px;',
		#'height'		=>'100px',
		#'PromptMessage'		=> '<div style="width:200px">Noch mher Input</div>',
		'style'    => 'width: 248px;',
		'required'	=> false,
		));
        
        #Datum
        $datum=$this->createElement('DateTextBox','datum',array(
        'label'          => 'Datum',
        'required'       => false,
        'invalidMessage' => 'Ungültiges Datum spezifiziert.',
        #'formatLength'   => 'long',
         'style'			=> 'width:245px;',
	     )
	     );
	     

        
        $submit=$this->createElement('SubmitButton','submit',array(
        'label'			=> 'senden',
        'style'			=> 'margin-left:308px;width:200px;',
        ));
        
        
        
        $this->addElements(array($datum,$ueberschrift,$info,$submit));
        
	}
}